home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / Process.h < prev    next >
Encoding:
Text File  |  1993-01-14  |  3.0 KB  |  97 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Originator: Kent Sandvik
  5.   Date: Wednesday, June 10, 1992 22:37:24
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TProcess is a Process Manager class.
  9.   Process.h contains the header file information for the TProcess class construction.
  10.   _________________________________________________________________________________________________________ */
  11.  
  12. // Declare label for this header file
  13. #ifndef _PROCESS_
  14. #define _PROCESS_
  15.  
  16.  
  17. #ifndef _DTSCPLUSLIBRARY_
  18. #include "DTSCPlusLibrary.h"
  19. #endif
  20.  
  21. //    Toolbox Include Files
  22.  
  23. #ifndef __PROCESSES__
  24. #include <Processes.h>
  25. #endif
  26.  
  27. #ifndef __APPLEEVENTS__
  28. #include <AppleEvents.h>
  29. #endif
  30.  
  31. #ifndef __OSUTILS__
  32. #include <OSUtils.h>
  33. #endif
  34.  
  35. //    GLOBAL TYPEDEFS AND ENUMS
  36. const ProcessSerialNumber kMyProcess = {
  37.                                         kNoProcess, kNoProcess};
  38.  
  39.  
  40. // _________________________________________________________________________________________________________ //
  41. //    Class Interface
  42.  
  43. class TProcess
  44. // The TProcess class provides information from the Process Manager.
  45. {
  46. public:
  47.     //    CONSTRUCTORS & DESTRUCTORS
  48.     TProcess(ProcessSerialNumber = kMyProcess);    // default constructors
  49.     virtual~ TProcess();                        // virtual destructor
  50.  
  51.     //  MAIN INTERFACE
  52.     virtual Boolean KillApplication(ProcessSerialNumber*);// quit the application
  53.     virtual short GetNumProcesses();            // get the N amount of currently running procs
  54.     virtual ProcessInfoRec GetProcessInfoRec();    // fetch the whole process info rec
  55.     virtual unsigned long GetProcessSize();        // get the size of the process
  56.     virtual unsigned long GetFreeMem();            // get free memory available for the process
  57.     virtual unsigned long GetLaunchDate();        // get in seconds the launch time
  58.     virtual Boolean FindProcess(OSType signature);// find process with the right signature
  59.  
  60.     //    PUBLIC ACCESSORS AND MUTATORS            
  61.     virtual ProcessSerialNumber GetMyProcessID() const;
  62.     virtual ProcessSerialNumber GetProcessID() const;
  63.  
  64.     // ITERATORS
  65.     virtual void Next();                        // next PSN
  66.     virtual Boolean Last();                        // last PSN?
  67.     virtual void First();                        // reset to first PSN
  68.  
  69.     //    INITIATION ROUTINES                        
  70. protected:
  71.     virtual Boolean IProcess();                    // initialize needed class information
  72.  
  73.     //    FIELDS
  74. private:
  75.     ProcessSerialNumber fProcessID;                // any specific PSN number
  76.     ProcessSerialNumber fMyProcessID;            // our PSN number
  77.     ProcessSerialNumber fFirstPSN;                // the first one we got
  78.     Boolean fFirstTime;                            // signals order of iterators
  79.     Boolean fLast;                                // used to signal last process in an iterator list
  80.     Boolean fState;                                // state of the object
  81.     OSErr fError;                                // latest toolbox error
  82. };
  83.  
  84.  
  85. #endif
  86.  
  87. // _________________________________________________________________________________________________________ //
  88.  
  89.  
  90. /*    Change History (most recent last):
  91.   No        Init.    Date        Comment
  92.   1            khs        6/10/92        New file
  93.   2            khs        7/6/92        First decent working class
  94. */
  95.  
  96.  
  97.